package fatworm.storage.types;

import fatworm.query.constant.*;
import fatworm.storage.table.*;

public abstract class SType
{
    static public final byte NULLFLAG = 1;
    static public final byte NOTNULLFLAG = 0;

    public abstract void fromBytes(byte[] bytes);
    public abstract byte[] toBytes();
    public abstract int length();
    public abstract byte[] toBytesAsVID(VID vid);
    public abstract int lengthAsVID();
    public int lengthInTuplePage()
    {
        if (Types.isVarType(this.getType()))
            return this.lengthAsVID();
        else
            return this.length();
    }
    public abstract int getType();
    public abstract Constant toConstant();
    public abstract void fromConstant(Constant c);
    public abstract SType newInstance();
    public abstract SType copy();
    public int getM()
    {
        return -1;
    }
}
